<?php
class ent_imagefile extends Lead_EDO_Object_Abstract
{
    static $_tables = array('ent_picfile');
    static $_dTables = array('ent_picfile_multi');
    
    
    public $picpath;
    public $picpath_file;
    public $picsize;
    
    public $thumbpath;
    public $thumbpath_file;
    
    public $thumbsize;

    
    private $_extension = array(1 => ".png", 2 => ".jpg", 3 => ".png");
       
    public function fetch($id)
    {
        parent::fetch($id);
        
        $app = Led_Application::getInstance();
        
          
   		if($this->picfile) {
			$this->picpath = $app->getRetailRoot() . "/data/23/" . $this->picfile;
			$this->picpath_file = $app->getExpoRoot() . "/data/23/" . $this->picfile;
			$this->picsize = getimagesize($this->picpath_file);
			
			if (!$this->thumbtype) {
				// $this->CreateAlternates();
			}
			
			$this->thumbpath = $app->getRetailRoot() . "/data/23/" . $this->id . "_thumbnail" . $this->_extension[$this->thumbtype];
			$this->thumbpath_file = $app->getExpoRoot() . "/data/23/" . $this->id . "_thumbnail" . $this->_extension[$this->thumbtype];
			
			if(is_file($this->thumbpath_file))
				$this->thumbsize = @getimagesize($this->thumbpath_file);
		}
        
		
        return $this;       
    }
    
    
}
